package tools;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;

import java.io.FileNotFoundException;

public class CutPictureUtils{

    private Context mContext;

    public CutPictureUtils(Context context) {
        mContext = context;
    }


    /**
     * 通过URL获得图片
     * @param uri
     * @return 返回图片
     */
    public Bitmap decodeUriAsBitmap(Uri uri){
        Bitmap bitmap = null;
        try {
            bitmap = BitmapFactory.decodeStream(mContext.getContentResolver().openInputStream(uri));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return null;
        }
        return bitmap;
    }

}
